The economic structure of a society, the material conditions of existence, is its base. The value systems, ways of life and institutional political structures (in a superficial sense) are its superstructure. The superstructure of characteristic class feelings, ways of thinking, myths, etc, serve its members as the believed conscious motives of individuals, but it is in fact class that determines action. Reason in this superficial sense belongs to the superstructure. I think I act from self-interest, but egoism actually perpetuates the capitalist mode of production; I think I act from religious duty (my personal bond with God, piety), but this in fact perpetuates the feudal economic system. When the intellectuals of a class produce a value system (religion, metaphysics, ethics, etc.) for these feelings, beliefs, it becomes ideology. The correct explanation of the existence of values is IDEOLOGY.
However, as we shall see, ideology is (can be?) a form of unfreedom, understood as the hindering of self-realisation. If I am ignorant about the true ends of my actions (when I act from supposedly religious motives, piety for example, what I am in fact doing is furthering the interests of the bourgeois class), can I be said to be free? Take the example of the child and medicine: he believes that he does not want the medicine because he does not like it, but he is unaware of the fact that it will make him better and he wants to be better, surely? Similarly, in obtaining a degree, you believe you are helping yourselves when in fact the real motive is to keep the unemployment lists manageable by making you invisible for three years. I am only free when my actions are self-transparent, that is I am aware of the final ends of my actions and endorse it as my good.