Should one offer to take over a lecture that the lecturer is struggling to teach?
Perhaps the best approach would be to ask leading questions that helps the lecturer head in the right direction.  Or, offer an answer to a question that wasn't going well.

I've taught classes (especially ones that use complex libraries, such as parts of a game engine, that I wasn't a seasoned expert with), and have had students who had more experience with a specific topic chime in to the discussion with details I didn't know.  It was great. I've also had students who were aggressive and conveyed arrogance and had them derail the class by setting up a me vs them dynamic.  Not so great.

The most important thing is classroom dynamics:  let the lecturer retain control (ie. facilitate the discussion) but you actively participate. The lecturer should be there to create a learning environment, not bestow knowledge on the class.  You can make it clear you know the topic, and let them have you participate as much as they are comfortable.

Asking to "take over" would not go over well;  offering your knowledge on bits and pieces and nudging the lecturer in the right direction through questions would be better.