In primary school, you were not able to control who your friends were. This decreased towards the end of your tenure. Friends were decided by two factors: (limited) personal preference and (unlimited) parental control. Personal preference refers to the actual interests of the child in question. Parental control is the deciding factor, however. They can create an environment where a child is taught to like other children from a certain class, cultural or status background. In my case, I went to a middle class school in a middle class area of suburbia. I have no non-White friends to this day and am somewhat intolerant of working class difficulties.
In secondary school, there is even less freedom to manoeuvre. By the end of primary school you are part of an In-Group or an Out-Group. You are also shunted into a class which doesn't change at all until the end of Junior Certificate, on other words three years. Being key formative years, it can be extremely difficult to conform with the In-Group by the end of the three years. The classes become divided within themselves as In and Out and between themselves as In and Out. The various In-Groups gel together well while the Out-Groups find it difficult to do the same, possibly due to a desire to Out the Out-Groups to please the In-Groups. There is greater exposure to class, status and cultural differences - in my case, I was in a room of farmers and immigrants. There was still a solid core of middle class whites that I identified better with. There was a lot of racism present but also victimised reactions which made things hazy. I do not defend the actions of anyone, but it became harder to know who was right and wrong over time.
Beyond secondary and primary, one is allowed to revolutionise their friendships. My retroactive perspective is probably completely wrong, but I'll follow this up with a post about College.