You can't get a friend code any more for the DS games; Nintendo closed the wifi system for those.
For X&Y, your FC is the code of your 2/3DS, not your game. To do that, you need to go to the home page of your 2/3DS, and then click the little square orange smilie that's on the top row of your bottom screen. It'll ask you to set up a Mii and then it'll show your FC on the top screen.