The building inspector is considered an ex officio member of the planning and zoning commission and shall assist and advise such commission in matters before it. In the exercise of the powers vested in it by this chapter, the planning and zoning commission may, in its discretion, refer to any other agency of the city, county or state for an advisory opinion on any matter properly before it with respect to which it believes that such advisory opinion would be helpful to it in reaching its own determination.