School should never replace a church. I'm an atheist, and I believe that knowledge and science are the best ways to understand the world. I also believe that people should have a choice. And to make a good choice you need to have a knowledge. To understand our global history we need to know something about religions. Not about one of many religions (e.g. Christianity or Buddhism), but about all of them... Or most of them. People should have access to the knowledge of religions beyond their own. So religion class should teach about religion in general, it's mechanisms, it's impact in the world, about views of religious people etc. There should be no bias towards any religion. Educate, not preach is the way to go.
So the conclusion is? Mandatory religion class - definitely not. But optional religion class - why not? Children need to learn how to understand other people's views and taking religion class is one of the many ways to do it.