It's never too soon for kids to learn to be careful around adults they don't know. This is a tricky topic, so tailor your discussions to your child's age.
"Raise the subject when he is three and could get separated from you in a shopping mall or other busy place," recommends psychologist Anita Gurian, Ph.D., of New York University's Child Study Center. Give him a simple definition of who strangers are ("They're people you don't know").
Explain that she should never talk to a stranger, and that if one approaches her, she should tell a trusted adult. Mention the key exceptions -- for example, it's okay to talk to a police officer or a crossing guard, especially if she's in trouble. (Teach your child her name, address, and phone number so they'll be able to help her.)
Discuss how to treat acquaintances like the neighbor down the street or a store cashier. Explain that it's fine to be friendly, but not to go anywhere with a grown-up unless Mommy or Daddy says it's okay.
Once your child is school-aged, help him fine-tune his instincts. Walk him through scenarios, such as a stranger's driving up and asking for directions. Explore some acceptable responses (in this case, stepping away from the car before answering the question, then walking away, would be one. You should also note that adults don't usually ask kids for directions and it may be a warning sign). Stress that someone can look nice but still have bad intentions.
If your child travels your neighborhood on her own, go over some safe places she can duck into if she thinks someone's following her -- such as a friend's house or a store. Tell her that as a last resort she can ring the doorbell of someone's home and ask that person to phone you, without going inside the house.