I think I found the solution. Seemed a bit strange to me at first, but it makes sense. When I tried to write the definition of the swap function in the .cpp file the compiler told me that swap does not have access to Inner since it is private. The solution was to make it this swap function a friend of Outer as well!
In code:
.h:
class Outer
{
class Inner
{
int data;
friend swap(Inner& lhs, Inner& rhs);
}
friend swap(Inner& lhs, Inner& rhs);
}
.cpp:
void swap(Outer::Inner& lhs, Outer::Inner& rhs)
{
using std::swap;
swap(lhs.data, rhs.data);
}