It is conventional in library code development to put those kinds of "helper" classes (and functions) in a "detail" namespace, i.e., like this:
namespace my_library {
namespace detail {
class Node
{
public:
int data;
Node* next;
//...
//...
}
}
class List
{
private:
detail::Node* head;
//...
public:
//...
}
}
By convention, anyone looking or using your library should know that anything in the "detail" namespace (or sub-namespace) is "not safe for public consumption", so to speak. You can also go one step further and put the helper classes in another header (like "List_detail.h") to further "hide" them. Also, when generating your library's documentation (e.g., with doxygen), you should skip / omit / hide any declaration from the "detail" namespace (or sub-namespaces).
You can also place them in an unnamed namespace if that is appropriate (in terms of linking).
Nested classes are sometimes avoided by decree (in coding guidelines) because they are not always well handled by all compilers (mostly old sub-standard compilers).