One ignores players with no cities when determining who loses a city, so Player A must convert one of their cities into a settlement.
If the barbarians are stronger, they are victorious! If the barbarians win the battle, they pillage one or more cities. Pillaged cities are reduced to settlements (replace the city piece with a settlement). The barbarians pillage one city belonging to the player who had the lowest total strength of active knights when the barbarians attacked. Any player who contributed no knights are automatically considered to have the lowest total strength of active knights. If various players tie for having the lowest total strength of active knights, each of those players loses 1 of his cities.
Important: When determining which player has contributed the weakest group of knights, do not count any player who has no cities or any player who has only metropolises. These players are immune to the effects of the barbarian attack.
5th ed rules