I am working on a library which had several headers that are meant to only be used by the library itself. I also have a few classes and functions in headers that I do not want the client to use. For instance, I have a header that contains debugging functions, but they should not be used outside of the library as it could cause problems.

Yes, you can do this in C++ by using the PIMPL idiom. If you use this idiom you only need to let the client see a header defining a simple wrapper class, which has a pointer to the real class as its data member. Because you are using a pointer, you would only need to forward declare the real implementation class in the header of the wrapper class. The header of the real implementation class only needs to be included in the .cpp file of the wrapper, so the client will never see it.

Having said that, using PIMPL adds complexity to your code. Now, if you need a new public member function, you would have to add it in two places. Also, you would have to go through more levels of call stack when you debug. You should really think long and hard whether hiding some functions from your client is worth this extra work.

P.S. The PIMPL idiom has another important use. It lets you break dependencies between components, which reduces coupling making your code easier to modify, and it can also significantly reduce the build time.