Probably yes, but ask your DM
First of all – Yes you can::
Your character can do things that are not covered by the actions in
this chapter …
When you describe an action that is not listed anywhere else in
According to the rules, the DM will tell you whether this action is possible
and what kind of role you have to do, if any
PHB page 193, "Actions in Combat"
The player's manual explicitly describes an object interaction:
You can also interact with an object or a function of the environment for free
For the DM you may have to use an action for one of these activities
PHB page 190, "Other Activities on Your Train"
The only question is – what mechanics will the DM use to assess this? Will he get you to take an action? Well, we don't know your DM and ultimately it's up to them, but here's my advice.
So your ally ends her turn and gives you permission to get his weapon. Let's simplify the situation a little and assume that he drops the gun at the end of the turn. You can pick up this weapon on your turn without taking any action With a "free object interaction" you give the rules. The mechanics therefore explicitly allow a weapon to be handed over, provided the weapon is not used between rounds. It is up to the players to describe this action using the narrative.
Now let's say the ally still allows you to get your weapon, for some reason it didn't drop the weapon. (S) he may want to do this for two reasons:
- The player does not want an enemy to pick up the dropped weapon
- The player wants a mechanical advantage by holding a weapon – a bonus from a magical item, the ability to make an occasional attack, etc.
Both only make sense if it is your opponent's turn between turns. In this case DM could say "Wait, you can't give a weapon you are currently using" and ask the player to take an action.
PHB describes a precedent for the delivery of an article
The player's manual on page 190 contains some examples of "free object interaction":
Here are some examples of what you can do with your move and action:
- Give an item to another character
So the rules assume that you can give your weapon to another character without spending any action. They don't describe to get a weapon of a different character (but that still doesn't mean you can't).
The 5th edition of D&D enables the DM in a way that the 3rd, 3.5 and 4th did not. While rule zero was always applied, the 5th edition decides not to explicitly codify many things. If your DM says you can't, you can't (but don't hesitate to ask "why").