Classification when some classes are dependent I think my problem can easier be explained via an example: Assume we have a dataset containing the images of 10 different mammals, let's say lion, elephant, cat, ... and horse. We have a 20-class image classification task where we want to detect whether an image belongs to lion-male or lion-female or cat-male or cat-female or ... horse-male or horse-female. As you see, the classes can be simply clustered into 10 mammal classes, i.e., (some) classes are highly dependent. 

This example is a kind of made up. Two strategies, imaginable to solve this problem is either we ignore this dependency and treat it as a 20-class classification task or use a hierarchical structure to first classify them into 10 class of mammals and then into male or female. The later however, ignores the fact that there might be (and in fact is) some shared properties in all males or in all females that can be used to discriminate them.

I was wondering if there is a methodological way to address this type of classification tasks. I'm looking for a keyword to google it. 
Thanks
I'm afraid there is no exact answer to your question.
In the scenario you described above male and female mammals are very similar, similar enough that the average person wouldn't notice the difference.
In such a case, I would suggest going with the first option of classifying into 10 classes of mammals and then building 10 classifiers of male-female.

This of course isn't an answer that applies to all cases, it is strongly dependent on a few factors, mainly on the classification scenario at hand.
The size of the dataset is also a significant parameter.
Unfortunately I don't think there is a methodological way to address this issue, only experience can point you towards the best solution.