When several persons claim to be entitled to the same office or franchise, one action may be brought against all such persons, in order to try their respective rights to such office or franchise.