title: How to pass objects as arguments?
body: <p>I have changed the code here
  all the variables have to remain private and using friend functions is a requirement.
  Here there are two classes A and B and I am supposed to accept 5 numbers(void enter()).The function average is to be able to access all variables and give the average.
  I know that currently the line</p>
  <pre><code> obj2.average(a,b,c,d,e);
  </code></pre>
  <p>will give an error as the variables are not accessible
  so my question is, how do I pass the variables in the last line?</p>
  <pre><code>#include&lt;iostream.h&gt;
  #include&lt;conio.h&gt;
  
  class A
  {
   int a;
   int b;
  
   public:
   friend class B;
   int enter1()
   {
    cout&lt;&lt;&quot;enter the value of a and b&quot;&lt;&lt;endl;
    cin&gt;&gt;a&gt;&gt;b;
    return(a,b);
   }
  };
  
  class B
  {
   int c;
   int d;
   int e;
  
   public:
   void average(int a, int b, int c, int d, int e)
   {
   float avg;
   avg=((a+b+c+d+e)/5);
   cout&lt;&lt;&quot;average is &quot;&lt;&lt;avg&lt;&lt;endl;
   }
  
   int enter()
   {
   cout&lt;&lt;&quot;enter the value of c,d,e&quot;&lt;&lt;endl;
   cin&gt;&gt;c&gt;&gt;d&gt;&gt;e;
   return(c,d,e);
   }
   };
  
  void main()
  {
   A obj1;
   B obj2;
   obj1.enter1();
   obj2.enter();
   obj2.average(obj1.a,obj1.b,obj2.c,obj2.d,obj2.e);
  }
  </code></pre>