People admire those who build homes for the poor or donate mosquito nets to those at risk of malaria — but they don’t necessarily want them as friends or romantic partners, a new study by researchers at Yale and the University of Oxford shows.

Asked to choose between do-gooders and those who place family members and friends first, subjects said they would rather spend time with those who made people close to them a priority, researchers report Aug. 23 in the Journal of Experimental Social Psychology.

“When helping strangers conflicts with helping family and kin, people prefer those who show favoritism, even if that results in doing less good overall,” said Yale’s Molly Crockett, assistant professor of psychology and senior author of the study.

The researchers created scenarios designed to test a tough moral dilemma: Is it better to help a family member, or a larger number of strangers? For instance, they asked whether a grandmother who wins $500 in the lottery should give it to her grandson to fix his car, or to a charity dedicated to combatting malaria. In another case, a young woman has to decide whether to spend the day with her lonely mother, or building homes for Habitat for Humanity.

Although participants in the study perceived both choices as equally moral, when it came to looking for a spouse or a friend, they preferred those who helped their grandson or spent the day with mom.

“Friendship requires favoritism — the key thing about friendship is that you treat your friends in a way you don’t treat other people,” said Oxford’s Jim Everett, first author of the study. “Who would want a friend who wouldn’t help you when you needed it?”

In contrast, this preference was reduced when participants were asked about qualities they wanted in a boss and disappeared when asked about desired traits in a political leader — a social role that requires impartiality.

“A political leader who represented the interests of themselves or their family over the country would be disastrous,” Everett said.

According to the researchers, these findings suggest a roadblock for “effective altruists” who argue we should donate money to charity to help relieve poverty and disease in the developing world rather than to a local group that would help fewer people.