My experience is that a tandem can be the missing link to join two different cyclists in one single ride.
It works! But...
As other said, communication is key, as is respect.
By that I mean that, if riding the same bike allows to match tow different effort levels, you still have to compromise on goals and riding style. Even if a member of the team can put in less effort, a hilly ride will still feel like a hilly ride, a fast ride like fast ride, a long ride as long ride, etc.
Sharing the bike allows for a quantitative combination of effort (watts); qualitative discrepancies will still be an issue.
Also, given that the pilot is the more accomplished cyclist, the team's riding style (effort, handling the bike, etc.) will evolve no faster than the stoker's ease to go along with the pilot's agility/temerity/effort type/pedal stroke/cadence.
Communication: with time, some sort of symbiosis develops between the captain and the stoker, until then, the captain should announce his every moves to the stoker. Gear changes, stops, coasting, resume pedalling, sharp turns, etc. Eventually, the stoker will feel most of this through his pedals and so much talking won't be necessary. The captain should also call major bumps and the like since the stoker can't see ahead.
There is no way to guarantee you love tandem riding but there are ways to avoid it being a bad experience.