Once friends, you’ll get in-game perks for playing together. Your Pokémon will get attack bonuses when battling gyms together, for example – and when you raid together, you’ll get extra Pokéballs.
The more you play together (raiding, battling gyms, etc), the higher your relationship level will be.
Certain - Pokémon - Legendaries - Shinies - Pokémon
Certain Pokémon (Legendaries, Shinies, and any Pokémon you don’t already have) are considered “special trades”. You can only make special trades with the players whom you’ve reached the higher tiers of friendship with. In other words, they mostly want you trading with the people you play with somewhat regularly – not rando spoofers selling Pokémon on eBay.