Lateral bipolar transistors in combination with diodes, or capacitors, or resistors