Comparative advantage is when a firm or country can produce a good at a lower opportunity cost than another firm or country. Opportunity cost refers to the value forgone when alternative is chosen. By countries specialising in their comparative advantage, overall production and consumption can be maximised as countries can then trade with each other, and surpluses are maximised.The theory of comparative advantage is therefore an argument in favour of free trade.
Hypothetical example: the UK can produce 6 cars and 4 bikes in an hour, and Mexico can produce 5 cars and 2 bikes in an hour.UK has an absolute advantage in both, however this doesn't mean they should produce both:To produce 1 car, the UK forgoes 2/3 of a bike (opportunity cost).To produce 1 car, Mexico forgoes 2/5 bike.The opportunity cost of producing 1 car is lower in Mexico's case therefore Mexico should produce cars and the UK should produce bikes, then they should trade.