This doesn't occur before the formal operational stage.
According to Jean Piaget, a Swiss psychologist, every person goes through 4 developmental stages:
- sensorimotor : birth - 24 months
- preoperational: 24 months - age 7
- concrete operational: 7 - 14
- formal operational: adolescence - adulthood
Only when we reach the final stage of development can we put ourselves in somebody else's shoes and see things from their perspective, according to Piaget.