That's an interesting question, and I don't think it's as cut and dry as Weav3r is saying, unless he has a log or source that shows it.
The basis of the question is that the bonus only works if you take damage that takes you below 1/4 life, or if you take damage once you are at 1/4 life. It doesn't work if you are below 1/4 life before the fight starts. This is to prevent dex mains from dropping themselves below 1/4 life using blood bags and then starting fights with a weapon that can give up to 100%+ bonus damage.
In the first case, I would assume if you took the damage while you were in the fight against B, it'd work against both people. That could be a kind of niche loophole where you get a friend with high speed to pillow attack you simply so you can get the bonus, although that's probably not worth the energy.
I think in the second instance, if both people were in the attack or even if they joined afterwards, the weapon bonus would be applicable against both opponents. But I'm not sure.
If you want to test it out, let me know. I have a comeback weapon and I can set it up if you're willing to give me an attack.