In Scala, a class paired with a same-named companion object in the appropriate source context. They can access each other's private members. This permits a companion object to hide implementation-node definitions while the corresponding class creates and manipulates those nodes.[ref]
Scala 2.13 classes and objects specification. Private modifier and companion access
New to topics? Read the docs here!