Discrete Choice with Social Interactions and Endogenous Memberships