title: In Scala, how do I access a case class's private constructor from its companion object
body: <p>I have the following code defined (in Scala IDE/Scala Worksheet with Scala 2.10):</p>
  
  <pre><code>object WorkSheet1 {
    object A {
      def apply(s: String, huh: Boolean = false): A = A(s)
    }
    case class A (s: String)
    //case class A private (s: String)
    val a = A("Oh, Hai")
  }
  </code></pre>
  
  <p>And I successfully receive the following output:</p>
  
  <blockquote>
    <p>a  : public_domain.WorkSheet1.A = A(Oh, Hai)</p>
  </blockquote>
  
  <p>However, when I comment out the existing <code>case class A (s: String)</code> and uncomment out the other one (containing "<strong>private</strong>"), I receive the following compiler error: "constructor A in class A cannot be accessed in object WorkSheet1".</p>
  
  <p>It was my understanding that a companion object had access to all of it's companion class's private parts. Heh. Uh...seriously, though. What gives?</p>