title: How can I detect whether a type is a visible base of another type?
body: <p>If I do</p>
  
  <pre><code>struct A{};
  struct C:private A{};
  
  typedef char (&amp;yes)[1];
  typedef char (&amp;no)[2];
  
  template &lt;typename B, typename D&gt;
  struct Host
  {
   operator B*() const;
   operator D*();
  };
  
  template &lt;typename B, typename D&gt;
  struct is_base_of
  {
  template &lt;typename T&gt; 
  static yes check(D*, T);
  static no check(B*, int);
  
  static const bool value = sizeof(check(Host&lt;B,D&gt;(), int())) == sizeof(yes);
  };
  
  int main(){
   std::cout&lt;&lt;is_base_of&lt;A,C&gt;::value&lt;&lt;std::endl;
  }
  </code></pre>
  
  <p>I get a 1. I would like to get a 0 when <code>C</code> is a private <code>A</code>, and a 1 when <code>C</code> is a public <code>A</code>.</p>
  
  <p>[the code is derived from <a href="https://stackoverflow.com/questions/2910979/how-is-base-of-works">How does `is_base_of` work?</a> ]</p>