 This approach may be used in friendly function when a function needs to access private data in objects from two different classes.This may be accomplished in two similar ways

using namespace std;
class Foo; // Forward declaration of class Foo in order for example to compile.class Bar {
class Foo {
// Definition of a member function of Bar; this member is a friend of Foo
void Bar