Generally if you wont want to expose parts of an exported class, then you should consider the option of not exposing the class, but instead providing an abstract interface that your class inherits from.
eg.
class AbstractExportedInterface
{
public:
virtual void do_stuff() = 0;
};
class HasStuffIDontWantToExport : public AbstractExportedInterface
{
public:
void do_stuff();
void do_other_stuff_that_i_dont_export();
};
then you would operate on the assumption that you are providing a HasStuffIDontWantToExport* to the DLL user and they only have headers for AbstractExportedInterface.
EDIT: Response to first comment
If you have some types (3rd party or otherwise) that you want your client of the DLL to be able to use in some way, but you dont want them to have full access to those types, and you dont have the flexibility to use a direct inheritance hierarchy to create an abstract interface. You might be able to use pimpl pattern to create proxy interfaces for each of the types you want your client to have limited usage of?
eg.
class ExportedAbstractProxyObject
{
public:
virtual void do_stuff() = 0;
};
#include <3rdPartyType.h>
class ProxyObject
{
public:
void do_stuff() { pimpl_.actually_do_stuff(); }
private:
3rdPartyType pimpl_;
};
class ExportedAbstractProxyOtherObject
{
public:
virtual void do_stuff_with_thing(ExportedAbstractProxyObject* thing) = 0;
};
class ProxyOtherObject
{
public:
void do_stuff_with_thing(ExportedAbstractProxyObject* thing) { thing->do_stuff(); }
};
So then you can happily export whatever interfaces you like, and completely hide the implementation and 3rd party types inside your DLL. The downside is you obviously then have to create all those proxy object interfaces.