I will try to give you a hint how to rewrite your problem as an binary optimization problem which can be solved on quantum annealer, i.e. a single purpose quantum computer for solving optimization task (see more about annealers here).
Your problem as an binary assignment problem:
Lets denote $x_{ik} \in \{0;1\}$ a binary variable meaning whether a person $i$ is assigned to a taxi $k$ (i.e. $x_{ik} = 1$) or not (i.e. $x_{ik} = 0$). Further let $P$ be a set of persons and $T$ set of taxis. Without loss of generality, assume that number of taxi is half the number of persons (in case number of persons is odd, you can add a dummy person, when the dummy is assigned to some taxi, this means that only one person is in the taxi).
Lets denote $c_{ijk}$ a cost of assigning persons $i$ and $j$ to taxi $k$. In case the persons are friends then $c_{ijk} = 1$, in case they hate each other then $c_{ijk} = -1$ and if one person is the dummy one then $c_{ijk} = 0$.
Your objective function is
$$
f = \sum_{i,j \in P \\k \in T} c_{ijk}x_{ik}x_{jk} \rightarrow \mathrm{MAX},
$$
subject to conditions
$$
\forall k \in T: \sum_{i \in P} x_{ik} = 2
$$
and
$$
\forall i \in P: \sum_{i \in T} x_{ik} = 1
$$
The first condition means that there are two persons in each taxi, the second one means that each person is assigned to just one taxi.
Now you can employ a quantum annealer to perform the optimization.