The barbarian subclass Berserker gets the feature Retaliation at level 14, which allows making a melee weapon attack as a reaction to taking damage.
RETALIATION
Starting at 14th level, when you take damage from a creature that is within 5 feet of you. you can use your reaction to make a melee weapon attack against that creature.
The PHB says the following about reactions (p. 190, emphasis mine):
Certain special abilities, spells, and situations allow you to take a special action called a reaction. A reaction is an instant response to a trigger of some kind, which can occur on your turn or on someone else’s. The opportunity attack, described later in this chapter, is the most common type of reaction. When you take a reaction, you can’t take another one until the start of your next turn. If the reaction interrupts another creature’s turn, that creature can continue its turn right after the reaction
So, technically, would a barbarian with this feature be able to take his Retaliation attack when he gets hit by an opportunity attack?
It seems somewhat weird to get an additional "action" (not action-action) during your turn, just by intentionally taking an opportunity attack (and it hits).