I’m looking content management system that would have features similar to stackoverflow:
Users can ask and answer/questions.
Users can search within existing threads.
The system is access controlled – so some users can be readers/writers/admins.
Some or all QnA threads should be visible only to logged in users.
So far I’ve mostly used wordpress as CMS but it looks like it’s not well-suited for this particular task
WordPress is ok as a CMS, but really just for publishing articles within a framework and simple commenting. If you want something as nice as StackOverflow, you can license it commercially.
PHPBB2 is a good open-source bulletin-board style forum, and VBulletin is a commercial option. They both use PHP, MySQL, etc..