Cooperation, competition, and welfare in a matching market