A Friend Code is a special identifying code that everyone who uses on Nintendo Wi-Fi Connection has. The DS, due to lacking any kind of account system, had friend codes for each game. On the Wii, DS and 3DS, both players are required to enter each other's friend code. On the 3DS, players do have the option of trading friend codes locally via infrared and certain games like Animal Crossing: New Leaf allow players to add friends they play regularly with. On Nintendo Switch there are many ways to add friends.
They did not use friend codes on the Wii U, instead using Nintendo Network IDs . They used them again with the Nintendo Switch. The Switch version of Friend Codes are not required with a number of options like adding via Nintendo Network ID, Twitter and recent players as well as local exchange.