Despite of the misleading signal name, "+12V" is actually around 5V and compared with 5V regulator output. Unfortunately LM358 (as well as LM339) common mode range does not include the positive rail, it's up to 1.5V below the rail or so.
This could work with a input rail-to-rail comparator, more reasonably, you divide the batter yoltage down to e.g. 2.5V and the reference, too.
Maximum ratings should be also considered. The OP as substrate diodes clamping the inputs to Vcc. I presume that LM358 can tolerate some clamping current, but it should be limited to a low mA value. Vbat voltage divider should be made with resistors in a 10 kOhm range to assure this..