This howto is written during alpha patch 2.6.3. The howto may or may not be relevant in later game patches.
There are a few different ways to add friends/contacts in Star Citizen, either through a web browser or in the game. What they all have in common is the other person will need to add you back for them to show up as online in your contacts list.
Through a web browser
My user handle is srbz, and my profile is at https://robertsspaceindustries.com/citizens/srbz. To get to someone’s user profile, simply swap the “srbz” part of that URL with their user handle, and click “follow” on their profile.
Or, you can search for contacts to add. Press “My RSI”, then “Contacts”, then “Add citizen to your list”.
Here you can search for user handles, and press the + sign by their name to add them.
To bring up your contacts list, press F11. Then, to bring up your cursor, press Right Alt (AltGr) + [the key next to your right shift key]. This would for instance be RAlt + / on a UK keyboard, and RAlt + – on a German keyboard. Press the text field in your contacts list to highlight it, although it doesn’t appear to be highlighted. Type in the user handle that you want to add, and press add.
If you’re in a party with someone you don’t already have in your contacts list, they will show up in your contacts list while the party persists. Press their name and click “Add user”.
Note that for some reason this seems to only work for one friend per game restart. If you want to add more people in one go I suggest you use the web browser instead.