Judge can decide who is a "child", Supreme Court rules