Just use a forward declaration:
class Graph {
// ...
private:
struct GEdge;
// ^^^^^^^^^^^^^
// Forward declaration for GEdge
struct GNode
{
std::string currency_type;
std::vector<GEdge> edges; // <== This is now OK because of the
// forward declaration above
GNode( std::string name ) : currency_type( name ) {}
};
struct GEdge // <== Now comes the definition of GEdge
{
int weight;
GNode * node; // node that the edge is pointed towards
GEdge( int weight, GNode* node )
: weight( weight ), node( node ) {}
};
// ...
};
Here is a complete live example of the above code compiling.