so i am sitting and talking to this girl, we are having a good energetic conversation faced towards each other. this guy who is kinda of an alpha and sometimes-douchey, who i know for a fact seeks reputation and power , comes from the opposite side asking a question about our physics paper. the girl turns towards him to answer him, now her back is faced towards me, and i am expecting that this will be a short doubt. But it turns into a long discussion. 1-2 mins into their doubt-solving-convo, i have taken out a book and have started reading but i am still facing this girl bcuz i had adjusted my legs that way when i was talking to her. If i had moved my legs to the front it would have clearly looked like this guy just came in and stole the person i was talking to,so i just sat in a cross reading my book waiting for their convo to end. then this guy turns to me with a smirk and asks me to give him a pen to write the answer in his book. now this part makes no sense. clearly he can ask her, theres nothing i am doing that makes it seem like i would have a pen on me or that she wouldnt. i shrug to tell him i would have to look for it in my bag and the girl cuts me off before i do that to give the guy her pen. I feel like that was a power move by the guy. 1st by making me follow his order he would have set an unspoken authority-subordinate relationship and 2nd to make it acknowledged between us that the person i was talking to so energetically with just a few minutes ago ,was now not because she was talking to him. He left after 5-6mins and the girl turned to my direction again and my convo with her resumed.

i know this seems over-analysing but i have seen this guy practice other malicious/not-straightforward tactics with other people to make himself look superior. He doesnt like to be undermined and likes attention and power along with reputation.

What should have i done? I feel like i would have lost or felt lower in social standing had she not given him her pen, or if our conversation had not returned back after he left. What would have been a counter-move?should i have moved my legs back and faced in front to act as if i have moved on from the convo or whatever? should i have called him on asking me for a pen -but that would be too aggressive i think. what should have i done??

i feel like in these subtle psychological warfares where social hierarchies are formed sub-consciously in everybody's mind i find it difficult to assert my place properly.

any suggestion/advice is appreciated.