Ok 1) press x 2) go to your bag 3) go to your key items pocket 4) scroll down to your pal pad 5) then you can see your friend code or add a frends friend code like this.
Hit "See my friend code" for your friend code
Hit "Add new friend code" then add name and then the friends friend code
If you dont have our pal pad do this
1) go down stairs in any pokemon center 2) then a girl will talk to you and give you your friend code
If your friend code isnt there do this
1) go down stairs in a pokemon center 2) connect to wifi 3) disconnect to wifi 4) look at your pal pad 5) go to your friend code and it will be there