After you beat the first gym go downstairs in any Pokémon Centre and talk to one of the ladies by the door. They'll give you a Pal Pad, then you can connect to the WFC by chatting to them and you'll get your friend code.