How to set and call private data members of multiple classes? : <p>Overview: I'm trying to create a bank account program that has multiple classes (4 to be exact). Here's the heirarchy - </p>

<blockquote>
  <p>Bank</p>
  
  <blockquote>
    <p>Account accounts;</p>
  </blockquote>
  
  <p>Account </p>
  
  <blockquote>
    <p>Depositor depositor_info;</p>
    
    <p>Int Account_number;</p>
    
    <p>Double account_balance;</p>
  </blockquote>
  
  <p>Depositor</p>
  
  <blockquote>
    <p>Name depositor_name;</p>
    
    <p>string Social Security Number;</p>
  </blockquote>
  
  <p>Name</p>
  
  <blockquote>
    <p>String first, last;</p>
  </blockquote>
</blockquote>

<p>I can set the depositor's name, and then assign depositor to an account. However I can't seem to print out the depositor's name. Here's the main testing code:</p>

<pre><code>Account test[MAX_ACCTS];

string first = "john", last = "doe", social = "132456789";
int acctNumber = 987654;
Name name;
Depositor depositor;

name.setFirst(first); // works
name.setLast(last); // works

depositor.setName(name);  // this works
depositor.setSSN(social); // this works

test[1].setDepositor(depositor); // this also works. 

cout &lt;&lt; test[1].getDepositor(); // Here I get an error:
no match for 'operator&lt;&lt;' (operand types are 'std::ostream {aka std::basic_ostream&lt;char&gt;}' and 'Depositor')
</code></pre>

<p>What am I doing wrong?</p>
