Friends will now get "Trainer Codes" to share with one another, which can be entered to become friends in the app. Once you're friends with someone there are multiple actions you can perform to increase your Friendship Level, like sending them gifts or participating in raids and gym battles with them. As this level grows, bonuses can be unlocked when you play together, so "Great Friends" can gain in-battle advantages, like attack bonuses.
Friendship Levels can be increased once per day per friend, and the new friend-based mechanics lead into the game's trading system. If you are near your friend (within 100 meters) and have reached a Trainer Level of 10 or higher, the game will let you trade Pokémon that you've caught. Trades cost Stardust, and Niantic says that once your Friendship Level increases players will be able to complete trades "with much less Stardust."
Special Pokémon like a legendary, shiny, or any Pokémon not in your Pokédex will have their own "Special Trade" rules: they can only occur once per day with a Great Friend or Best Friend, and cost "a lot of Stardust." Every trade also earns players bonus candy for the Pokémon that has been traded away, and the amount of candy increases if the Pokémon being traded were captured in regions far apart from each other.
Pokémon trading was one of the missing features of Pokémon Go that players asked for after the game launched in July 2016. Months later in early 2017, Niantic CEO John Hanke said that trading would be coming "soon." Speaking with The Verge, Niantic software engineer Kirsten Koa explained that the nearby trading mechanic has been a focus of development since the game launched: "We wanted to make sure we got this right... It took two years for us to build that feature — that's how hard it was."