Though in medieval times, children of the wealthy and nobility would often get a religious education. If I remember my medieval history correctly, many of the Christian monks would be the teachers. But, indeed, an education would generally be the privilege of the rich.