title: C++ forget to declare variable type causes error
body: <p>I'm confused why the following code cannot compile because of the following bug: <code>'rootLevel' was not declared in this scope</code>. </p>
  
  <p>In my understanding, the <code>struct NodeLevel</code> is declared and defined before <code>class Solution</code>, is this not a sufficient condition for this class to be available to the <code>Solution</code> class?</p>
  
  <p>Thanks!</p>
  
  <pre><code>struct NodeLevel{
      int level;
      BinaryTreeNode * node;
      NodeLevel(int val, BinaryTreeNode * x) : level(val), node(x) {}  
  };
  
  class Solution {
  public:
      vector&lt;vector&lt;int&gt;&gt; levelOrder(BinaryTreeNode* root) {
          queue&lt;NodeLevel&gt; q;
          rootLevel = NodeLevel(0, root);
          q.push(rootLevel);
  
          /*
          do some stuff with the queue 
          */
      }
  };
  </code></pre>