Your friend code in Animal Crossing: City Folk is given to you by the guard dog at the town gate — the one on the right-hand side when you approach.
Write it down carefully, because you will need to exchange codes with another player before you can visit each other's towns. Both players must have registered each other, and the gate needs to be open for travel to work.
If the dog will not share it, check that you are not in the middle of an event at the gate — the attendant handling arrivals can occupy the same space and change who you are actually talking to.