Stellar and planetary Cassini states