I'm playing with Scala Spray. I enjoy working with it but can't figure out one thing.

This code compiles fine:

```
import spray.http.MediaTypes._
import spray.routing.HttpService
import spray.json.{DefaultJsonProtocol, _}
import spray.httpx.SprayJsonSupport._

trait StatusService extends HttpService {

  case class StatusResponse(status: String)

  object StatusResponseProtocol extends DefaultJsonProtocol {
    implicit val statusResponse = jsonFormat1(StatusResponse)
  }

  import StatusResponseProtocol._

  val statusRoute =
    path("status") {
      get {
        respondWithMediaType(`application/json`) {
          complete {
            StatusResponse("OK")
          }
        }
      }
    }
}

```

But it doesn't compile (can't find json serializer) when I move case class & protocol to the companion object.

```
trait StatusService extends HttpService {

  import StatusResponseProtocol._

  val statusRoute =
    path("status") {
      get {
        respondWithMediaType(`application/json`) {
          complete {
            StatusResponse("OK")
          }
        }
      }
    }
}

object StatusService {

  case class StatusResponse(status: String)

  object StatusResponseProtocol extends DefaultJsonProtocol {
    implicit val statusResponse = jsonFormat1(StatusResponse)
  }
}

```

I do not understand why..