(Rui wa tomo wo yobu; “Like calls unto like”)
People will naturally self-sort. People who are similar will tend to find each other, group together, and become close. “Birds of a feather flock together.” Nerds sit at lunch with nerds, jocks with jocks, band geeks with band geeks.
The topic of discussion, as shown by the topic-marker particle は (wa), is the noun 類 (rui), “kind,” “type,” “equal,” “peer,” etc. In this case it refers to people who resemble each other in some aspect or who get along well. What they do (technically, the verb associated with this topic) is 呼ぶ (yobu), “call (out to),” and the direct-object marker を (wo) shows that what is called to is 友 (tomo), “companions.”
Despite the English parallel given at the top, it’s an error to replace 友 with a second 類.
This saying is derived from the synonymous phrase 類を以て集まる (rui wo motte atsumaru), which in turn is derived from a saying in the I Ching.
(“Rui wa tomo wo yonde, itsu no ma ni ka kono gakkou ni bungei saakuru ga dekita mitai.”)
[“I guess like called to like, and before you knew it our school had a literature club.”]