Group $C^*$-algebras of locally compact groups acting on trees