Nintendo Switch's day one update, which is out now, reintroduces Friend Codes as the main method to add friends. The update--which also adds the eShop--means you can register new pals by searching locally, by looking at a list of people you recently played with, and by linking to your Miitomo or Super Mario Run accounts. But Friend Codes remain the primary way of expanding your friend list.
Nintendo Switch lets users claim a unique Account User ID, similar to Xbox Live's Gamertags and PSN's account naming system. This had led many to believe adding friends on Switch would work in a similar way to those services, which also allow users to search by real names. However, it seems that isn't the case at present on Nintendo's new platform.
Wii U featured the ability to add players using their Nintendo Network ID, a separate system similar to that of PSN and Xbox Live. Switch's Account User ID replaces the Nintendo Network ID scheme, but it is not being utilized for adding friends, it seems.
Friend Codes were first introduced with the Nintendo DS, which allowed players to add each other by having both people enter each other's respective 12-digit codes into their devices.