the answer is by the age of 10 years
Children within the age of 4-10 years old tend to still not understanding the complexity of human relationship, but they alreay understand that both parents figure that they have are important persons in their life. When the parents separated within this age period, the child will most likely feel confuse on who to follow.