Friendship is an act of choice. I am not friends with everyone I’ve met; rather, I have some sort of criteria, a mix of explicit and implicit (or conscious and unconscious) attributes that I value in a friend. Some will be purely behavioural, and some are based on values and beliefs. It’s highly unlikely that all of my friends will share an “entire belief system” (I think that’s probably true for most people), but certainly some of my values are more important to me than others.
For example, I am a vegetarian, but I have many meat-eating friends. However, I have no friends that are overtly racist and/or sexist.
Sometimes you will know if someone has or does not have those values when you meet them. Sometimes you will only find out later. Sometimes you only realize those values in yourself later. In the first case, you probably wouldn’t befriend the person at all; in the second and third, you are then presented with the difficult choice of deciding if the history of the friendship outweighs the revelation of the value split.
To continue my example, if I meet someone and they say something racist, I will not pursue friendship with them. And, although I haven’t explicitly “broken up” with very many friends (I am not great with confrontation), I have reduced some friends to acquaintances because of racist or sexist things they’ve said.