Go downstairs at any Pokemon center and talk to the lady closest to the stairs. They won't allow you to go down there untill a certain point in the game. I think it is when you beat Roark, the first gym leader, and get the coal badge.
That's from wikianswers ^_^ Once you have it, you need to connect to a wifi connection (go downstairs in a Pokemon center and talk to the middle lady. save, etc. once you go into the room, you can go out.) and then go to your Key Items pocket and click Pal Pad and Use. Then go down to the third option. There's your Friend Code. :D Then once you start adding people (and they have to add you as well) you can see them in that middle room you went into before. :) Then you can trade, battle, voice chat (like a phone), play plaza games, etc. etc.
That's from wikianswers ^_^ Once you have it, you need to connect to a wifi connection (go downstairs in a Pokemon center and talk to the middle lady. save, etc. once you go into the room, you can go out.) and then go to your Key Items pocket and click Pal Pad and Use. Then go down to the third option. There's your Friend Code. :D Then once you start adding people (and they have to add you as well) you can see them in that middle room you went into before. :) Then you can trade, battle, voice chat (like a phone), play plaza games, etc. etc.