title: Declaring an instance of an explicit specializtion of a template within a regular class
body: <p>I can't get this to compile at all. I may not be possible but I don't know why it should not be.</p>
  
  <pre><code>class A {
    template &lt;typename T&gt; 
    class B {
     int test() { return 0; }
    };
    //template &lt;&gt; class B&lt;int&gt;; &lt;-with this, namepace error
    B&lt;int&gt; myB_;
   };
  
   template &lt;&gt; class A::B&lt;int&gt; {
    int test() {
     return 1;
    }
   };
  </code></pre>
  
  <p>As it appears the compiler complains "The explicit specialization "class A::B" must be declared before it is used." 
  If I try to provide the froward declaration in the commented line, the compiler complains 
  "The explicit specialization "B" must be declared in the namespace containing the template."
  We use 2 different compilers here. This error is from IBM's "xl" compiler on AIX but I get similar errors with different verbage when compiling on our Sun systems. 
  It seems like a catch-22. </p>
  
  <p>Obviously, this is a highly contrived, simplistic example but, it represents the problem.
  I want to define a template class within a class because the template class is only relevent to the containing class. There should be no access to the template from outside the class.</p>
  
  <p>Am I missing something?  </p>