Models can fight if they are in base contact with an enemy model when it is their chance to attack, even if the models' bases only touch at the corner.
Even models attacked in the side or rear may fight. In such cases the models are not actually turned to face their enemy – we simply assume that the individual warriors twist around as best they are able in the tight press of warriors.
Normally, a warrior can only strike blows against an enemy model in base contact. The most common exception is if they are making a supporting attack.
However, you may always direct attacks against normal rank and file models, as long as the model is in base contact with any model of the enemy unit (including characters and command group models).
If a model has more than one Attack and find itself in base contact with two or more enemies with different characteristic profiles, it must choose which one to attack when its turn to strike comes (before any dice are rolled).