Comparative advantage is the economic theory of international trade developed by Ricardo. It says that even when one country can produce far more products than another country if it devotes all of its resources to one, the opportunity cost of those products may be higher in a developed country than in a developing country. So despite the USA being able to produce both more bananas and more cars than Brazil, Brazil would probably have to sacrifice less cars in order to make bananas than the USA. This is the theory that gives most countries a basis for trade. Trade should not take place where one country can produce more of both at the same opportunity cost as another country, eg. Where the USA can produce 100 bananas for every 10 cars, and Brazil can produce 10 bananas for every 1 car.
Comparative advantage, then, suggests that specialisation is the key to international trade success.
One of the problems with comparative advantage is that it assumes that there are no barriers to trade/protectionist measures or any transport costs. In reality, these two would add to or take away from the cost of trading, therefore making a weaker/stronger case for trade. The model of comparative advantage also assumes that there are only two countries involved, and they make only two goods, which is, of course, not the case. Similarly, Ricardo's theory assumes that countries can switch production from one thing to another without any sort of cost or time delay. It could be seen as a criticism of the theory of comparative advantage that it suggests that specialisation important for countries. While specialisation in some instances is good, it can mean that an economy becomes dependant on trade, and isn't self-sufficient. This may not be a problem, but if tastes change or if the market takes a turn for the worse for the country's main export, then the entire welfare of the country could be compromised.
The final criticism of the theory is that it leaves out the fact that international trade and international politics are strongly linked. The UK does lots of trade with the EU because of the lack of trade barriers; but another of the UK's main trade partners is the USA, who can implement as many trade barriers as they wish (not to mention that the US is around 4,000 miles away.) The reason for this is because international relations with the USA are strong, and as a strong trade partner, we would be inclined to continue trading with them so as not to compromise our relationship (even if that means real/opportunity cost to the UK.)