At 3 I was probably still just trying some sort of distraction rather than reasoning or explanations. However, for the last few years (I have a 6 year old) I have come up with the following rules which my DD hasn't found a way to argue with
If on "neutral" territory, other kids' toys are theirs only and she can't expect to play with them; their toy, their rules.
If at another child's house "it's Friend's house so he gets to make the rules"
If at our home, "Friend is the guest so you need to be polite and let him play with your toys while he is here, afterwards they are all yours again".
I require that my kids share their toys in all circumstances - if they have a friend over it is the polite thing to do if they want to continue having play dates, and if we are at a playground they can only bring things they are willing to share, otherwise the toy goes away.