"Friend Codes" are a recent trend in online gaming (mostly by Nintendo) where instead of having a screen name, your online identity is given to you by the game as a number anywhere from 12 to 16 digits in length. Both players must add eachother's respective friend codes to their friends roster before they can play together. You are expected to only show this number to people you trust.
"Friend codes" exist because the game host doesn't like young children to be exposed to adults playing the same game without their consent. To their credit, friend codes do what they're supposed to, and it's very effective. The problem is that friend codes are expected to be acquired outside the game, while out in the real world. This is a big hassle to gamers that don't have much social time available to spend on finding their friends' friend codes.
The solution is to allow gamers to give out their friend code while playing an anonymous game. So, for example, you could play an anonymous game with someone and if you'd like to play with them again, you could give the person your friend code while in-game. If the player reciprocates, then you have enough to add them.
There are a couple of issues with this. First is that this essentially becomes an online friend request system, but with a lot more hassle. I say that hassle is not always a bad thing. This number entry system requires that each person spend extra time adding the other person's code to their friend roster. Most are way too lazy to do that, and this likely includes most online predators.
The second issue is that we don't want to give players in an anonymous game the option to send custom messages.
Some games that require communication between players in order to function efficiently choose to implement "Canned Responses". Players are allowed to send messages set beforehand by the developer, which essentially only lets the player talk about things relevant to the game. Canned response systems however are not perfect, and the game developer cannot know with absolute certainty what canned responses would be the most useful to the players until after the game is released.
Final Fantasy Crystal Chronicles: Echoes of Time (FFCC:EoT) uses preset canned responses for in-game chat. Anonymous games have to use the developer-made canned responses system, which is detailed but cumbersome to use. Players are allowed complete freedom over what they can say in games between friends, but also have the option of customizing 12 canned responses of their own.
FFCC:EoT also uses a friend code system.
If FFCC:EoT were to have a canned response in anonymous games that shows your friend code, it would remove a lot of the hassle involved while also remaining secure. It would still require both players to choose to display their friend code and for both players to exit the session in order to add the other's friend code. However, having friend codes be shown in-game would mean you could go from showing the code to adding the person as a friend in a matter of minutes instead of hours or days.
I also recommend that players be given the option to display a canned response containing a fake friend code. If a person receives a friend code from another person but doesn't want to add them, simply not responding or outright rejecting the sender could result in the sender being a jerk for the rest of the session. If you're given the option to send a canned response containing a fake friend code, there's a good chance the sender will interpret it as friend acceptance. The sender might either continue the session with you, or quit (thinking you're quitting as well in order to add them). Either way, your friend code remains safe.