title: Sealed classes inside another class in Kotlin can't be compiled: cannot access '<init>' it is private
body: <p>If I used the example from the <a href="https://kotlinlang.org/docs/reference/sealed-classes.html" rel="noreferrer">docs</a>, </p>
  
  <pre><code>class SomeActivity : AppCompatActivity() {
      sealed class Expr
      data class Const(val number: Double) : Expr()
      data class Sum(val e1: Expr, val e2: Expr) : Expr()
      object NotANumber : Expr()
  }
  </code></pre>
  
  <p>it does not compile, with the error:</p>
  
  <pre><code>Cannot access '&lt;init&gt;', it is private in 'Expr'.
  </code></pre>
  
  <p>However, moving it outside the enclosing class makes it compile:</p>
  
  <pre><code>sealed class Expr
  data class Const(val number: Double) : Expr()
  data class Sum(val e1: Expr, val e2: Expr) : Expr()
  object NotANumber : Expr()
  
  class SomeActivity : AppCompatActivity() {
  }
  </code></pre>
  
  <p>Why is this so? Is this an intended behavior? The docs does not seem to mention this.</p>