title: How do I forward declare a template type that has been forward declared elsewhere with a defaulting
body: <p>So the excellent answer to <a href="https://stackoverflow.com/q/48282811/2642059">this question</a> states that you can default template types in a forward declaration, however:</p>
  
  <blockquote>
    <p>You can specify each default template argument only once</p>
  </blockquote>
  
  <p>This is more fully specified in the linked question, but Boost's Property Tree stuff works with the <code>ptree</code> type:</p>
  
  <pre><code>typedef basic_ptree&lt;std::string, std::string&gt; ptree;
  </code></pre>
  
  <p>But the <code>basic_ptree</code> class is defined like this:</p>
  
  <pre><code>template&lt;class Key, class Data, class KeyCompare&gt;
  class basic_ptree
  </code></pre>
  
  <p>The only reason the <code>ptree</code> <code>typedef</code> is defined with only 2 template parameters is that before it's <code>typedef</code> there is the forward declaration:</p>
  
  <pre><code>template &lt; class Key, class Data, class KeyCompare = std::less&lt;Key&gt; &gt;
  class basic_ptree;
  </code></pre>
  
  <hr>
  
  <p>This brings me to my actual question. I need to pass around a <code>ptree</code>. But I don't want to include <code>Boost</code> in my headers. This means that I'll have to forward declare. <em>But I can't match the defaulted forward declaration because the default can only be declared once.</em></p>
  
  <p><strong>How can I write a forward declaration and forward typedef that depends upon the defaulting in another headers forward declaration?</strong></p>
  
  <p>I'm currently doing this, but that means I'm <em>not</em> forward <code>typedef</code>'ing, I'm making a <em>new</em> <code>typedef</code>:</p>
  
  <pre><code>template &lt;class Key, class Data, class KeyCompare&gt; class basic_ptree;
  typedef basic_ptree&lt;std::string, std::string, std::less&lt;std::string&gt;&gt; ptree; 
  </code></pre>
  
  <p>For the sake of consistency I want to depend on the same defaulted forward declaration of <code>basic_ptree</code> that the original <code>ptree</code> <code>typedef</code> depended upon.</p>