title: Constructor cannot access private members of its own class
body: <p>I get the following error in Visual Studio 2008: error C2248: 'Town::Town' : cannot access private member declared in class 'Town'. It looks like the constructor is unable to access the members of its own class. Any idea what's going on? 
  Here's the code: </p>
  
  <p>I have this: </p>
  
  <pre><code>template&lt;class T&gt; class Tree{...}
  </code></pre>
  
  <p>And this class: </p>
  
  <pre><code>class Town{
      Town(int number):number(number){};
      ...
  private: 
      int number;
  };
  </code></pre>
  
  <p>Which is used in this class: </p>
  
  <pre><code>class Country{
  public:
      StatusType AddTown(Shore side, int location, int maxNeighborhoods);
  private:
      Tree&lt;Town&gt; towns[2];
      ...
  }
  </code></pre>
  
  <p>And here's the AddTown function: </p>
  
  <pre><code>StatusType Country::AddTown(Shore side, int location, int maxNeighborhoods){
      if (maxNeighborhoods&lt;0 || location&lt;0){
          return INVALID_INPUT;
      }
      Town* dummy= new Town(location);//Here be error C2248
      if (towns[side].find(*dummy)!=NULL){
          delete dummy;
          return FAILURE;
      }
      SouthBorder* dummyBorder;
      (side==NORTH)?dummyBorder=new SouthBorder(location,0):dummyBorder=new SouthBorder(0,location);
      if (southBorders.find(*dummyBorder)!=NULL){
          delete dummyBorder;
          return FAILURE;
      }
      towns[side].add(*dummy);
      delete dummyBorder;
      return SUCCESS;
  }
  </code></pre>