Consumption externalities, habit formation, and equilibrium efficiency