First and foremost, from the code above, forward-declare where possible. This should help a bit.
// Renderer.h
class Texture;
class Renderer {
...
};
// Renderer.cpp
#include "Renderer.h"
#include "Texture.h"
...
// Texture.h
//class Renderer; // looks like this isn't needed
class Texture {
...
};
// Texture.cpp
#include "Renderer.h"
#include "Texture.h"
...
With the forward declarations, you should have enough to declare pointers to Texture in the Renderer class header. It looks like that's all you need at this point; push the rest to Renderer.cpp.
Next, avoid friends; however, it might be acceptable in this case.
Finally, circular dependencies are never a good thing. See if you can change your design a bit. See if you can introduce an interface or an abstract base class in order to break your circular dependency. It looks like Renderer shouldn't really need to depend on Texture at all.
Instead, consider rewriting Renderer to depend on some sort of ITexture interface, and then let Texture implement ITexture:
class ITexture
{
// no data members
// no method bodies
// only pure virtual method declarations
};
class Renderer
{
public:
ITexture* loadTexture(std::string fileName);
private:
std::map<std::string, ITexture*> textureDb;
};
class Texture : public ITexture
{
...
};