Investments in education and welfare in a two-sector, random matching economy