Even if you have an absolute advantage in EVERY SINGLE CAPACITY, trade can easily be seen as advantageous.
We'll use $/hour as a unit of productivity -- I.e., $20/hour is twice as productive as $10/hour. Doing so can lead to problems if we carry it too far, but for this discussion it is safe.
For Example: If Doctor #1 can see patients for a value of $50/hour, research diseases for $30/hour, and write books about how to be healthier for $15/hour... but Doctor #2 can only see patients for $40/hour, research diseases for $25/hour, and write books for $10/hour...
... then it's still worthwhile to trade between the two.
Without trade, Doctor #1 would spend 33% of his time dedicated to each task. that would be 33% of a 40 hour week to treating patients, 33% to research, and 33% to book writing -- and Doctor #2 did the same --- this would net Doctor #1 a total of about $1266.67 each week, and it would net Doctor #2 a total of about $1000. Between the both of them, that equals about $2266.67 (Here, both doctors did each job a total of 66% of their total labor hours)
But if Doctor #1 instead decided to dedicate 66% of his time towards treating patients, and 33% towards research, and then hire doctor #2 to split his time 33% towards research and 66% writing books, then -- the same amount of work is done -- but the total amount drawn in is about $2310. Doctor #1 would draw in about $1700, and about $610 would be Doctor #2. This looks bad for Doctor #2, but we also have to remember that Doctor #1 is trading with doctor #2, so likely #1 would pay #2 a few extra bucks. - To make the trade profitable for both parties, #1 could pay #2 about $400.... yet #1 would still be making about $40 or so more than he would have without trade.
Through trade, even though Doctor #2 sucked horribly in each category, they together were able to generate about $45 more than they would have independently of one another.
Both jobs were done in the same quantities: a total of 66%. But because of specialization, they all benefited even though Doctor #2 sucked.
I will happily admit that the numbers are completely made up - but it doesn't really matter: Surely through the soon-to-be 7 Million people on this planet a more profitable combination can come about. The numbers might be made up, but it could have been anything in any amount - Trade allows specialization, and specialization generates wealth.