Wireless sensors offer great advantages when monitoring the environment or industrial applications due to their flexible and fast implementation. In order to power those sensors, the use of energy harvesting to extract power from their immediate surroundings is a viable option. Even wireless energy transfer between neighboring sensors is becoming popular due to huge advances in the field. Here, we introduce a system engineering approach to model such systems. With our framework, optimization techniques can be used in order to derive policies on when and how to use the available energy in order to achieve the best possible performance. A network of energy harvesting and energy sharing sensors is investigated by means of theoretical results and illustrative simulations.