Labor Market Frictions as a Source of Comparative Advantage: Implications for Unemployment and Inequality