Marxism philosophically opposes religion, but politically tolerates it
While Marxism philosophically opposes religion, it politically tolerates it in the recognition that superior scientific ideas will prevail in the long run through persuasion, social practice and the benefits of science and technology. Marxism carries over from liberal democracy the principle of upholding the freedom of thought and belief.
This is also why Lenin’s socialist party did not enforce that members have to be atheist. The atheist/theist divide is not central but secondary, and people will naturally become atheist in the future.