The grammar of the sentence 'Why can you be friends of all my ex-girlfriends?' is incorrect. A possible correction could be: 'Why are you friends with all of my ex-girlfriends?'