When I started this question I suspected it wasn't possible to get what I want, because of other similar SO answers.
By the time time I finished the question I came up with a work around that's suits my needs, it is not really explicit conversion, so your mileage may vary depending on exactly what you need to achieve.
I thought I might as well post it in case someone finds it useful.
Work around
Add the following definitions:
class MyExtension : public ThirdPartyClass
{
public:
MyExtension(const char*) : ThirdPartyClass(0) {}
};
bool ThirdPartyFunction(int a, MyExtension obj)
{
return ThirdPartyFunction(a, (ThirdPartyClass)obj);
}
Now it is possible to call
ThirdPartyFunction(1, "Hello, World!");
Note the above can be done without modifying third party code. It does rely on overloading the function, so if you had to do this for many functions it might not be feasible. You could also avoid the inheritance, and just convert from MyExtension
to ThirdPartyClass
in the overloaded function.