I never understood these.
Friend codes can be used to battle and trade with a specific person via wireless connection.exchanging friend codes far away helps with challenging a specific opponent far away.
If you enter a 3DS friend,you can now get their safari in kiloude city and battle with them.
You input the friend code into your DS, then it will give you the option to battle, trade or talk with them anytime. It also gives you rare Pokemon for the friend safari.