title: Magnolia: Type derivation fails in case of nested type classes
body: <p>I am trying to create a serializable trait that has a dependency on type class.</p>
  <pre><code>package dsl
  import zio.schema._
  
  sealed trait Random[A] {
    def generate: A
  }
  
  object Random {
    case object RandomDouble extends Random[Double] {
      override def generate: Double                           = ???
      implicit val RandomDoubleSchema: Schema[Random[Double]] = DeriveSchema.gen[Random[Double]]
    }
  }
  
  sealed trait DummyExpr[A] {
    def eval(value: DummyExpr[A]): A
  }
  
  object DummyExpr {
    case object DummyTrue  extends DummyExpr[Boolean] {
      override def eval(value: DummyExpr[Boolean]): Boolean = ???
    }
    case object DummyFalse extends DummyExpr[Boolean] {
      override def eval(value: DummyExpr[Boolean]): Boolean = ???
    }
  
    case class DummyOperator[A](random: Random[A], predicate: DummyExpr[Boolean]) extends DummyExpr[A] {
      override def eval(value: DummyExpr[A]): A = ???
    }
  }
  
  object main extends App {
    val schemaRandom = DeriveSchema.gen[Random[Double]]
    val schemaDummy  = DeriveSchema.gen[DummyExpr[Double]]
  }
  
  </code></pre>
  <p>Here is a reproducible link <a href="https://scastie.scala-lang.org/3PnmF52hSkuduzGP10wTdg" rel="nofollow noreferrer">https://scastie.scala-lang.org/3PnmF52hSkuduzGP10wTdg</a></p>
  <p>But type derivation for this fails with the error <code>magnolia: could not find any direct subtypes of trait Random</code></p>
  <p>I am using zio-schema which internally uses magnolia. I tried adding implicit Derivation of typeclass too but that didn't help too.</p>