Pineapple X,
1 - On the main 3DS menu, up the top of the bottom screen should be like a smiley orange face thing. Click on it
2 - Go across to your friend card. It should then appear at the top of your 3DS screen. Your friend code is on that card on the bottom right.
3 - To add a friend code. Click the top right orange + button that says register friend, then click internet. Then add my code
. Both people have to register eachothers codes for you to be registered on their friends list