title: Member is inaccessible from Template class object in parameter
body: <p>I have a class which has a function that takes in a template List object as a parameter. Using this List object i'm supposed to:</p>
  
  <pre><code>//receives a List of NVPair objects and sets the data value in a data member
  //of an object in the list according to the corresponding name in the name - value pair
  </code></pre>
  
  <p>Here is my class and function:</p>
  
  <pre><code>class Cartoon : public Object {
  
      string type;
      string name;
      string likes;
  
  public:
  
      void set(const List&lt;NVPair&lt;string, string&gt;, 10&gt;&amp;&amp; list) {
  
          //set to this
          list.objArray[0] 
      }
  
  };
  </code></pre>
  
  <p>Here is the List template class:</p>
  
  <pre><code>template&lt;typename T, int MAX&gt;
  class List {
  
      T objArray[MAX];
      int index;
  
  public:
  
      List() : index(0) {}
  
      size_t size() const {
  
          return index;
      }
  
      const T&amp; operator[](int i) const {
  
          //try {} shit
          return i &lt;= MAX &amp;&amp; i &gt;= 0 ? i : -1;
      }
  
      void operator+=(const T&amp; t) {
  
          objArray[index++] += t;
      }
  
      void operator+=(T&amp;&amp; t) {
  
          objArray[index++] += move(*t);
      }
  
  };
  </code></pre>
  
  <p>Why can't I access the member objArray? It says the member is inaccessible. </p>
  
  <p>The first template argument is of NVPair, another class template. It is:</p>
  
  <pre><code>template&lt;typename N, typename V&gt;
  class NVPair {
  
      N name;
      V value;
  
  public:
  
      NVPair() :name(""), value("") {}
      NVPair(N n, V v) : name(n), value(v) {}
      N name() const { return name; }
      V value() const { return value; }
  
  };
  </code></pre>
  
  <p>I tried setting the data members to protected instead of private but this changes nothing. I also tried setting the </p>
  
  <pre><code>void set(const List&lt;NVPair&lt;string, string&gt;, 10&gt; &amp;&amp; list)
  </code></pre>
  
  <p>as a pointer type, one reference, no reference or pointer but nothing changes. The member is inaccessible. I think my parameter is wrong but I'm not sure what is wrong with it.</p>
  
  <p>Also the Object class that Cartoon derives off of:</p>
  
  <pre><code>class Object {
  
  public:
  
      virtual void set() = 0;
      virtual const std::string getDSV(char c = VALUE_DELMINITER) const = 0;
  
  };
  </code></pre>
  
  <p>Here is the code that calls the set function</p>
  
  <pre><code>auto list = new List &lt;T, OBJECTS_PER_JSON_FILE&gt;();
  auto members = new List &lt;NVPair &lt;std::string, std::string&gt;, DATA_MEMBERS_PER_OBJECT&gt;();
  
  //inside a switch loop
  case OBJECT_CLOSE:
  obj.set(*members);
  (*list) += obj;
  delete members;
  members = nullptr;
  break;
  </code></pre>