title: Why do both struct and class exist in C++?
body: <p>As we know, <code>struct</code> and <code>class</code> are interchangeable in many places in the language. Confusingly, the keywords themselves do not necessarily correspond to the language used in the standard. For example, in draft standard N4567 [class]/10, </p>
  
  <blockquote>
    <p>A <em>POD struct</em><sup>109</sup> is a non-union class that is both a
    trivial class and a standard-layout class, and has no non-static data
    members of type non-POD struct, non-POD union (or array of such
    types). Similarly, a <em>POD union</em> is a union that is both a trivial
    class and a standard-layout class, and has no non-static data members
    of type non-POD struct, non-POD union (or array of such types). A <em>POD
    class</em> is a class that is either a POD struct or a POD union.</p>
  </blockquote>
  
  <p>In over-simplified terms, <code>struct</code> and <code>class</code> are interchangeable in the following cases:</p>
  
  <ul>
  <li>declaration of a "class"</li>
  <li>declaration of a scoped enumeration type</li>
  <li>elaborated type specifier unless the "class" was declared with <code>union</code></li>
  </ul>
  
  <p>However, <code>struct</code> <em>explicitly</em> cannot be used in a template declaration to introduce type template parameters:</p>
  
  <pre><code>template &lt;struct T&gt; // error
  </code></pre>
  
  <p>I'm unable to see any significant difference between <code>struct</code> and <code>class</code>, even in the POD example above because a <em>POD struct</em> as defined in the standard can be declared with either <code>struct</code> or <code>class</code>. </p>
  
  <blockquote>
    <p>[class]/8 A <em>standard-layout struct</em> is a standard-layout class
    defined with the <em>class-key struct</em> or the <em>class-key class</em>. A
    <em>standard-layout union</em> is a standard-layout class defined with the <em>class-key union</em>.</p>
  </blockquote>
  
  <p>This seems rather redundant and confusing while introducing a glaring inconsistency.</p>
  
  <p>I have two questions:</p>
  
  <ol>
  <li><p>Are there any technical differences that I have missed that significantly distinguish <code>struct</code> and <code>class</code>?</p></li>
  <li><p>What is the rationale, if any, behind this clumsiness?</p></li>
  </ol>
  
  <p><sup>I'm ignoring the difference between default access specifiers because everyone knows that already.</sup></p>