Part-time judges are entitled to pensions, Supreme Court rules