She is single and got attached to a single
man.
What's wrong?
You mean by declaring your liking first means you can 'chop' place?
You got to realise that the girl still have her freewill to decide
who should become her boyfriend. First or not, it doesn't
matter if her choice isn't you.
This incident probably made you see a clearer picture of guy B and
that's about it. But technically speaking, he didn't do anything
wrong, though morally, as a friend, he may have done you some form
of wrong. 
Cheers