  We study the setting of single-winner elections with ordinal preferences
where candidates might be members of \emph{alliances} (which may correspond to
e.g., political parties, factions, or coalitions). However, we do not assume
that candidates from the same alliance are necessarily adjacent in voters'
rankings. In such case, every classical voting rule is vulnerable to the
spoiler effect, i.e., the presence of a candidate may harm his or her alliance.
We therefore introduce a new idea of \emph{alliance-aware} voting rules which
extend the classical ones. We show that our approach is superior both to using
classical cloneproof voting rules and to running primaries within alliances
before the election.
  We introduce several alliance-aware voting rules and show that they satisfy
the most desirable standard properties of their classical counterparts as well
as newly introduced axioms for the model with alliances which, e.g., exclude
the possibility of the spoiler effect. Our rules have natural definitions and
are simple enough to explain to be used in practice.
